package com.marion.jpa.controller;

import com.marion.jpa.query.UserSearchQuery;
import com.marion.jpa.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Marion
 * @date 2022/3/2 15:03
 */
@RestController
public class UserController {

    private final UserService userService;

    @Autowired
    public UserController(UserService userService) {
        this.userService = userService;
    }

    @GetMapping("/user/page")
    public Object userByPage() {
        return userService.findAllByPage();
    }

    @GetMapping("/user/search")
    public Object userSearchByPage(UserSearchQuery query) {
        return userService.searchUser(query);
    }



}
